package com.qd.common.sys.domain.entity.station;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;

/**
 * 岗位组织
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
@ToString
public class StationOrgDTO extends StationQueryDTO {

    @ExcelIgnore
    @JsonIgnore
    private static final String EXCEL_TITLE = "岗位和机构关系";
    /**
     * 主键
     */
    @ExcelProperty(value = {EXCEL_TITLE, "岗位组织ID"})
    @NotBlank(message = "岗位组织ID不能为空", groups = {UpdateGroup.class})
    @Size(max = 50, message = "岗位组织ID长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    private String orgStationId;
    /**
     * 机构ID
     */
    @ExcelProperty(value = {EXCEL_TITLE, "*机构ID"})
    @NotBlank(message = "机构不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "组织长度不能超过{max}位", groups = DefaultGroup.class)
    private String orgId;
    /**
     * 机构名称
     */
    @ExcelProperty(value = {EXCEL_TITLE, "机构名称"})
    private String orgIdDisplay;
    /**
     * 职责ID
     */
    @ExcelProperty(value = {EXCEL_TITLE, "*职责ID"})
    @NotBlank(message = "职责ID不能为空", groups = DefaultGroup.class)
    @Size(max = 50, message = "职责长度不能超过{max}位", groups = DefaultGroup.class)
    private String stationId;
    /**
     * 职责
     */
    @ExcelProperty(value = {EXCEL_TITLE, "职责名称"})
    private String stationIdDisplay;
    /**
     * 添加时间
     */
    @ExcelProperty(value = {EXCEL_TITLE, "添加时间"})
    @NotNull(message = "添加时间不能为空", groups = DefaultGroup.class)
    private LocalDateTime addTime;

    @Override
    public void freeData() {
        this.orgStationId = null;
        this.orgId = null;
        this.stationId = null;
        this.addTime = null;
        super.freeData();
    }
}
